package com.frame.auth.mvc.web;

import com.frame.auth.model.ClientReq;
import com.frame.auth.mvc.service.ClientService;
import com.frame.common.tools.result.ServiceResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @auther zhangwj
 * @date 2021/3/24 下午2:51
 */
@RestController
@RequestMapping(value = "client")
public class ClientController {

    @Resource
    private ClientService clientService;

    @PostMapping(value = "create")
    public ServiceResult<Void> createClient(@RequestBody ClientReq clientReq) {
        try {
            clientService.createClient(clientReq);
            return ServiceResult.getSuccessResult();
        } catch (Exception e) {
            return ServiceResult.getFailureResult();
        }
    }
}
